<!DOCTYPE html>



  


<html class="theme-next pisces use-motion" lang="zh-Hans">
<head>
  <!-- hexo-inject:begin --><!-- hexo-inject:end --><meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.3" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/avatar.jpg?v=5.1.3">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/avatar.jpg?v=5.1.3">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/avatar.jpg?v=5.1.3">


  <link rel="mask-icon" href="/images/avatar.jpg?v=5.1.3" color="#222">





  <meta name="keywords" content="Java,Jvm,类加载," />










<meta name="description" content="类加载机制概述 虚拟机把描述类的数据从 class 文件加载到内存，并对数据进行校验，解析和初始化，最终形成可以被虚拟机直接使用的 java 类型，这就是虚拟机的类加载机制。 懒加载  类加载时机 初始化 遇到 new、getstatic、putstatic 或 invokestatic 这 4 条字节码指令时，如果类没有进行初始化，则需要先触发其初始化。生成这 4 条指令的最常见的 Java 代">
<meta name="keywords" content="Java,Jvm,类加载">
<meta property="og:type" content="article">
<meta property="og:title" content="类加载">
<meta property="og:url" content="http://fighterhit.github.io/2018/02/24/Java_Notes/Jvm/类加载/index.html">
<meta property="og:site_name" content="Fighter&#39;s Blog">
<meta property="og:description" content="类加载机制概述 虚拟机把描述类的数据从 class 文件加载到内存，并对数据进行校验，解析和初始化，最终形成可以被虚拟机直接使用的 java 类型，这就是虚拟机的类加载机制。 懒加载  类加载时机 初始化 遇到 new、getstatic、putstatic 或 invokestatic 这 4 条字节码指令时，如果类没有进行初始化，则需要先触发其初始化。生成这 4 条指令的最常见的 Java 代">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="http://fighterhit.github.io/2018/02/24/Java_Notes/Jvm/类加载/类加载时机.png">
<meta property="og:image" content="http://fighterhit.github.io/2018/02/24/Java_Notes/Jvm/类加载/类加载的过程.png">
<meta property="og:image" content="http://fighterhit.github.io/2018/02/24/Java_Notes/Jvm/类加载/类加载的过程.png">
<meta property="og:image" content="http://fighterhit.github.io/2018/02/24/Java_Notes/Jvm/类加载/类加载器.png">
<meta property="og:updated_time" content="2018-03-01T13:41:45.174Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="类加载">
<meta name="twitter:description" content="类加载机制概述 虚拟机把描述类的数据从 class 文件加载到内存，并对数据进行校验，解析和初始化，最终形成可以被虚拟机直接使用的 java 类型，这就是虚拟机的类加载机制。 懒加载  类加载时机 初始化 遇到 new、getstatic、putstatic 或 invokestatic 这 4 条字节码指令时，如果类没有进行初始化，则需要先触发其初始化。生成这 4 条指令的最常见的 Java 代">
<meta name="twitter:image" content="http://fighterhit.github.io/2018/02/24/Java_Notes/Jvm/类加载/类加载时机.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '5.1.3',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://fighterhit.github.io/2018/02/24/Java_Notes/Jvm/类加载/"/>





  <title>类加载 | Fighter's Blog</title><!-- hexo-inject:begin --><!-- hexo-inject:end -->
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <!-- hexo-inject:begin --><!-- hexo-inject:end --><div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Fighter's Blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">深度沉迷学习</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://fighterhit.github.io/2018/02/24/Java_Notes/Jvm/类加载/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Fighter.">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Fighter's Blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">类加载</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2018-02-24T16:58:42+08:00">
                2018-02-24
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Java笔记/" itemprop="url" rel="index">
                    <span itemprop="name">Java笔记</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="page-pv"><i class="fa fa-file-o"></i>
            <span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>
            </span>
          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="类加载机制"><a href="#类加载机制" class="headerlink" title="类加载机制"></a>类加载机制</h2><h3 id="概述"><a href="#概述" class="headerlink" title="概述"></a>概述</h3><ul>
<li>虚拟机把描述类的数据从 class 文件加载到内存，并对数据进行校验，解析和初始化，最终形成可以被虚拟机直接使用的 java 类型，这就是虚拟机的类加载机制。</li>
<li>懒加载</li>
</ul>
<h3 id="类加载时机"><a href="#类加载时机" class="headerlink" title="类加载时机"></a>类加载时机</h3><img src="/2018/02/24/Java_Notes/Jvm/类加载/类加载时机.png" title="类加载时机">
<h4 id="初始化"><a href="#初始化" class="headerlink" title="初始化"></a>初始化</h4><ol>
<li>遇到 <code>new、getstatic、putstatic 或 invokestatic</code> 这 4 条字节码指令时，如果类没有进行初始化，则需要先触发其初始化。生成这 4 条指令的最常见的 Java 代码场景是：使用 new 关键字实例化对象的时候、读取或设置一个类的静态字段（被 final 修饰、已在编译器把结果放入常量池的静态字段除外）的时候，</li>
<li>使用 Java.lang.refect 包的方法对类进行反射调用时，如果类还没有进行过初始化，则需要先触发其初始化。</li>
<li>当初始化一个类的时候，如果发现其父类还没有进行初始化，则需要先触发其父类的初始化。</li>
<li>当虚拟机启动时，用户需要指定一个要执行的主类（包含 main() 方法的那个类），虚拟机会先执行该主类。</li>
</ol>
<h4 id="不被初始化的例子"><a href="#不被初始化的例子" class="headerlink" title="不被初始化的例子"></a>不被初始化的例子</h4><ul>
<li>通过子类引用父类的静态字段，子类不会被初始化</li>
<li>通过数组定义来引用类</li>
<li>调用类的常量</li>
</ul>
<h3 id="类加载的过程"><a href="#类加载的过程" class="headerlink" title="类加载的过程"></a>类加载的过程</h3><img src="/2018/02/24/Java_Notes/Jvm/类加载/类加载的过程.png" title="类加载的过程">
<h4 id="加载"><a href="#加载" class="headerlink" title="加载"></a>加载</h4><ul>
<li>通过一个类的全限定名来获取定义此类的二进制流</li>
<li>将这个字节流所代表的静态存储结构转化为方法区的运行时数据结构</li>
<li>在内存中生成一个代表这个类的 class 对象，作为这个类的各种数据的访问入口</li>
</ul>
<h5 id="加载源"><a href="#加载源" class="headerlink" title="加载源"></a>加载源</h5><ul>
<li>文件<ul>
<li>class 文件</li>
<li>jar 文件</li>
</ul>
</li>
<li>网络</li>
<li>计算生成一个二进制流<ul>
<li>$Proxy</li>
</ul>
</li>
<li>由其它文件生成<ul>
<li>jsp</li>
</ul>
</li>
<li>数据库</li>
</ul>
<h4 id="验证"><a href="#验证" class="headerlink" title="验证"></a>验证</h4><img src="/2018/02/24/Java_Notes/Jvm/类加载/类加载的过程.png" title="类加载的过程">
<ul>
<li>验证是连接的第一步，这一阶段的目的是为了确保 class 文件的字节流中包含的信息符合当前虚拟机的要求。并且不会危害虚拟机自身的安全。</li>
<li>文件格式验证</li>
<li>元数据验证</li>
<li>字节码验证</li>
<li>符号引用验证</li>
</ul>
<h4 id="准备"><a href="#准备" class="headerlink" title="准备"></a>准备</h4><ul>
<li>准备阶段正式为<strong>类变量</strong>分配内存并设置<strong>变量的默认值</strong>。这些变量使用的内存都将在方法区进行分配。如果变量被 final 修饰，则在这个过程中，常量值会被一同指定。</li>
</ul>
<h4 id="解析"><a href="#解析" class="headerlink" title="解析"></a>解析</h4><ul>
<li>解析阶段是虚拟机将常量池中的符号引用替换为直接引用的过程。</li>
<li>类或者接口的解析</li>
<li>字段解析</li>
<li>类方法解析</li>
<li>接口方法解析</li>
</ul>
<p><a href="http://blog.csdn.net/u011080472/article/details/51329315" target="_blank" rel="noopener">【深入理解JVM】：类加载机制</a></p>
<h4 id="初始化-1"><a href="#初始化-1" class="headerlink" title="初始化"></a>初始化</h4><ul>
<li>初始化是类加载的最后一步</li>
<li>初始化是执行 <code>&lt;clinit&gt;()</code> 方法的过程<blockquote>
<p>类初始化阶段是类加载过程的最后一步，前面的类加载过程中，除了在加载阶段用户应用程序可以通过自定义类加载器参与之外，其余动作完全由虚拟机主导和控制。到了初始化阶段，才真正开始执行类中定义的Java程序代码（或者说是字节码）。<br>在准备阶段，变量已经赋过一次系统要求的初始值，而在初始化阶段，则根据程序员通过程序制定的主观计划去初始化类变量和其他资源，或者可以从另外一个角度来表达：初始化阶段是执行类构造器<clinit()>方法的过程。<br><a href="http://blog.csdn.net/u011080472/article/details/51329315" target="_blank" rel="noopener">【深入理解JVM】：类加载机制</a><br><a href="http://www.importnew.com/18548.html" target="_blank" rel="noopener">Java虚拟机类加载机制</a><br><a href="http://blog.csdn.net/qq_20176495/article/details/74936554" target="_blank" rel="noopener">类加载机制</a><br><a href="http://blog.csdn.net/zjkc050818/article/details/78376195" target="_blank" rel="noopener">【Java面试题】之类加载：从面试题分析Java类加载机制</a></clinit()></p>
</blockquote>
</li>
</ul>
<h3 id="类加载器"><a href="#类加载器" class="headerlink" title="类加载器"></a>类加载器</h3><ul>
<li>虚拟机的设计团队把类加载阶段中的“通过一个类的全限定名来获取描述此类的二进制字节流”这个动作放到 Java 虚拟机外部去实现，以便让应用程序自己决定如何去获取所需要的类。实现这个动作的代码模块称之为类加载器。</li>
<li>只有被同一个类加载器加载的类才可能会相等。相同的字节码被不同的类加载器加载的类不相等。</li>
</ul>
<h4 id="类加载器分类"><a href="#类加载器分类" class="headerlink" title="类加载器分类"></a>类加载器分类</h4><ul>
<li>启动类加载器<ul>
<li>由 C++ 实现，是虚拟机的一部分，用于加载 javahome 下的 lib 目录下的类</li>
</ul>
</li>
<li>扩展类加载器<ul>
<li>加载 javahome 下 /lib/ext 目录中的类</li>
</ul>
</li>
<li>应用程序类加载器<ul>
<li>加载用户类路径上的所指定的类库</li>
</ul>
</li>
<li>自定义类加载器<ul>
<li>定义一个类，继承 classloader</li>
<li>重写 loadclass 方法</li>
<li>实例化 class 对象</li>
</ul>
</li>
</ul>
<h4 id="自定义类加载器的优势"><a href="#自定义类加载器的优势" class="headerlink" title="自定义类加载器的优势"></a>自定义类加载器的优势</h4><ul>
<li>类加载器是 Java 语言的一项创新，也是 Java 语言流行的重要原因之一，它最初的设计是为了满足 Java Applet 的需求而开发。</li>
<li>高度灵活性</li>
<li>通过自定义类加载器可以实现热部署</li>
<li>代码加密</li>
</ul>
<h4 id="双亲委派模型"><a href="#双亲委派模型" class="headerlink" title="双亲委派模型"></a>双亲委派模型</h4><img src="/2018/02/24/Java_Notes/Jvm/类加载/类加载器.png" title="类加载器">
<ul>
<li>从 jdk1.2 开始，java 虚拟机规范推荐开发者使用双亲委派模型（ParentsDelegation Model）进行类加载，其加载过程如下：</li>
<li>如果一个类加载器收到了类加载请求，它首先不会自己去尝试加载这个类，而是把类加载请求委派给父类加载器去完成</li>
<li>每一层的类加载器都把类加载请求委派给父类加载器，直到所有的类加载请求都应该传递给顶层的启动类加载器</li>
<li>如果顶层的启动类加载器无法完成加载请求，子类加载器尝试去加载，如果连最初发起类加载请求的类加载器也无法完成加载请求时，将会抛出 ClassNotFoundException，而不再调用其子类加载器去进行类加载。</li>
<li>双亲委派模型的类加载机制的优点是 java 类 它的类加载器一起具备了一种带优先级的层次关系，越是基础的类，越是被上层的类加载器进行加载，保证了 java 程序的稳定运行。</li>
</ul>
<h3 id="虚拟机字节码执行引擎"><a href="#虚拟机字节码执行引擎" class="headerlink" title="虚拟机字节码执行引擎"></a>虚拟机字节码执行引擎</h3><ul>
<li>字节码结构</li>
<li>类加载</li>
<li>虚拟机字节码执行引擎</li>
</ul>
<h4 id="运行时栈帧结构"><a href="#运行时栈帧结构" class="headerlink" title="运行时栈帧结构"></a>运行时栈帧结构</h4><ul>
<li>局部变量表</li>
<li>操作数栈</li>
<li>动态链接</li>
<li>方法返回地址</li>
<li>附加信息</li>
</ul>
<p><a href="http://blog.csdn.net/sinat_33087001/article/details/77200623" target="_blank" rel="noopener">[深入理解JVM 六]—-虚拟机字节码执行系统</a><br><a href="http://blog.csdn.net/rusbme/article/details/51217620" target="_blank" rel="noopener">Java方法执行</a><br><a href="http://blog.csdn.net/ns_code/article/details/17965867" target="_blank" rel="noopener">【深入Java虚拟机】之五：多态性实现机制——静态分派与动态分派</a></p>
<h5 id="局部变量表"><a href="#局部变量表" class="headerlink" title="局部变量表"></a>局部变量表</h5><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line"><span class="comment">//实例变量有默认值，即便不赋值也可以直接使用</span></div><div class="line"><span class="keyword">private</span> <span class="keyword">int</span> a;</div><div class="line"><span class="keyword">private</span> <span class="keyword">int</span> b;</div><div class="line"></div><div class="line">add()&#123;</div><div class="line">    <span class="keyword">int</span> a, b;</div><div class="line">    <span class="keyword">return</span> a + b;<span class="comment">//没有赋值，报错</span></div><div class="line">&#125;</div></pre></td></tr></table></figure>
<ul>
<li>slot 32 64</li>
<li>byte、boolean、short、char、int、float、double、long（不会出现线程安全性问题）、reference（指向对象地址）、returnAddress（不再使用）</li>
</ul>
<blockquote>
<p>线程安全性问题三要素：</p>
<ol>
<li>多线程</li>
<li>要有共享资源</li>
<li>对共享资源进行非原子性操作</li>
</ol>
</blockquote>
<figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">int</span> a = <span class="number">10</span>;</div><div class="line">a--;<span class="comment">// a = a - 1;</span></div></pre></td></tr></table></figure>
<ul>
<li>slot 复用：当一个变量的 pc 寄存器的值大于 slot 的作用域的时候，slot 是可以复用的</li>
</ul>
<figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span></span>&#123;</div><div class="line">    <span class="keyword">byte</span>[] buff = <span class="keyword">new</span> <span class="keyword">byte</span>[<span class="number">60</span> * <span class="number">1024</span> * <span class="number">1024</span>];</div><div class="line">    System.gc();<span class="comment">//不回收</span></div><div class="line">&#125;</div></pre></td></tr></table></figure>
<figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line"><span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span></span>&#123;</div><div class="line">    &#123;</div><div class="line">        <span class="keyword">byte</span>[] buff = <span class="keyword">new</span> <span class="keyword">byte</span>[<span class="number">60</span> * <span class="number">1024</span> * <span class="number">1024</span>];</div><div class="line">    &#125;</div><div class="line">    <span class="keyword">int</span> a = <span class="number">10</span>;<span class="comment">//对局部变量表读写了</span></div><div class="line">    System.gc();<span class="comment">//回收，因此引用使用完使其为 null，方便垃圾回收</span></div><div class="line">&#125;</div></pre></td></tr></table></figure>
<p><a href="https://www.jianshu.com/p/a474dd20b08d" target="_blank" rel="noopener">局部变量表Slot复用</a></p>
<h5 id="操作数栈"><a href="#操作数栈" class="headerlink" title="操作数栈"></a>操作数栈</h5><p>每个栈帧不完全独立，实际上局部变量表的部分数据重叠<br><a href="http://blog.csdn.net/a616413086/article/details/51272309" target="_blank" rel="noopener">栈帧、局部变量表、操作数栈</a></p>
<h5 id="动态连接"><a href="#动态连接" class="headerlink" title="动态连接"></a>动态连接</h5><h5 id="方法返回地址和附加信息"><a href="#方法返回地址和附加信息" class="headerlink" title="方法返回地址和附加信息"></a>方法返回地址和附加信息</h5><ul>
<li>方法返回地址：调用时通过一个指向方法的指针指向方法的地址，方法返回时将回归到调用处，那个地方是返回地址。</li>
<li>附加信息：虚拟机规范中允许具体的虚拟机实现增加一些规范里没有描述的信息到栈帧中。这部分信息完全取决于虚拟机的实现。</li>
</ul>
<h3 id="方法调用"><a href="#方法调用" class="headerlink" title="方法调用"></a>方法调用</h3><ul>
<li>解析调用</li>
<li>分派调用<ul>
<li>静态分派调用</li>
<li>动态分派调用</li>
</ul>
</li>
<li><p>动态语言支持</p>
</li>
<li><p>方法调用并不等同于方法的执行，方法调用阶段的唯一任务就是<strong>确定被调用方法的版本</strong></p>
</li>
<li>封装、继承、多态</li>
</ul>
<blockquote>
<p>类加载过程中的解析作用：将 class 文件中的符号引用解析成直接引用</p>
</blockquote>
<h4 id="解析调用"><a href="#解析调用" class="headerlink" title="解析调用"></a>解析调用</h4><p>静态方法、构造器方法、私有方法和被 final 修饰的方法不能被重写、重载，编译完就能确定版本</p>
<ul>
<li>invokestatic（静态方法的字节码）</li>
<li>invokespecial（构造器方法、私有方法、父类方法生成的字节码）</li>
<li>invokevirtual</li>
<li>invokeinterface</li>
<li>invokedynamic</li>
</ul>
<h4 id="静态分派调用（单、多分派）"><a href="#静态分派调用（单、多分派）" class="headerlink" title="静态分派调用（单、多分派）"></a>静态分派调用（单、多分派）</h4><p>静态分派调用主要针对方法的重载（编译期确定？）：<br><figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">StaticCall</span> </span>&#123;</div><div class="line">    <span class="keyword">static</span> <span class="class"><span class="keyword">class</span> <span class="title">Parent</span> </span>&#123;</div><div class="line">    &#125;</div><div class="line">    <span class="keyword">static</span> <span class="class"><span class="keyword">class</span> <span class="title">Child1</span> <span class="keyword">extends</span> <span class="title">Parent</span></span>&#123;&#125;</div><div class="line">    <span class="keyword">static</span> <span class="class"><span class="keyword">class</span> <span class="title">Child2</span> <span class="keyword">extends</span> <span class="title">Parent</span></span>&#123;&#125;</div><div class="line"></div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">sayHello</span><span class="params">(Child1 c1)</span></span>&#123;</div><div class="line">        System.out.println(<span class="string">"c1 is called"</span>);</div><div class="line">    &#125;</div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">sayHello</span><span class="params">(Child2 c2)</span></span>&#123;</div><div class="line">        System.out.println(<span class="string">"c2 is called"</span>);</div><div class="line">    &#125;</div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">sayHello</span><span class="params">(Parent p)</span></span>&#123;</div><div class="line">        System.out.println(<span class="string">"p is called"</span>);</div><div class="line">    &#125;</div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</div><div class="line">        <span class="comment">//=左边静态类型 右边实际类型</span></div><div class="line">        Parent p1 = <span class="keyword">new</span> Child1();</div><div class="line">        Parent p2 = <span class="keyword">new</span> Child2();</div><div class="line">        StaticCall s = <span class="keyword">new</span> StaticCall();</div><div class="line">        s.sayHello(p1);</div><div class="line">        s.sayHello(p2);</div><div class="line">        <span class="comment">//实际类型发生改变</span></div><div class="line">        Parent p = <span class="keyword">new</span> Child1();</div><div class="line">        p = <span class="keyword">new</span> Child2();</div><div class="line">        <span class="comment">//静态类型发生改变</span></div><div class="line">        s.sayHello((Child2)p);</div><div class="line">    &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure></p>
<p>方法调用时会选一个最先匹配的执行：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div></pre></td><td class="code"><pre><div class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">StaticCallTest2</span> </span>&#123;</div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">sayHello</span><span class="params">(<span class="keyword">byte</span> a)</span></span>&#123;</div><div class="line">        System.out.println(<span class="string">"byte"</span>);</div><div class="line">    &#125;</div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">sayHello</span><span class="params">(<span class="keyword">short</span> a)</span></span>&#123;</div><div class="line">        System.out.println(<span class="string">"short"</span>);</div><div class="line">    &#125;</div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">sayHello</span><span class="params">(<span class="keyword">int</span> a)</span></span>&#123;</div><div class="line">        System.out.println(<span class="string">"int"</span>);</div><div class="line">    &#125;</div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">sayHello</span><span class="params">(<span class="keyword">long</span> a)</span></span>&#123;</div><div class="line">        System.out.println(<span class="string">"long"</span>);</div><div class="line">    &#125;</div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">sayHello</span><span class="params">(<span class="keyword">char</span> a)</span></span>&#123;</div><div class="line">        System.out.println(<span class="string">"char"</span>);</div><div class="line">    &#125;</div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">sayHello</span><span class="params">(Character a)</span></span>&#123;</div><div class="line">        System.out.println(<span class="string">"Character"</span>);</div><div class="line">    &#125;</div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">sayHello</span><span class="params">(Object a)</span></span>&#123;</div><div class="line">        System.out.println(<span class="string">"Object"</span>);</div><div class="line">    &#125;</div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">sayHello</span><span class="params">(<span class="keyword">char</span> ... a)</span></span>&#123;</div><div class="line">        System.out.println(<span class="string">"char ..."</span>);</div><div class="line">    &#125;</div><div class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</div><div class="line">        StaticCallTest2 s = <span class="keyword">new</span> StaticCallTest2();</div><div class="line">        s.sayHello(<span class="string">'1'</span>);</div><div class="line">    &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<h4 id="动态分派调用（单、多分派）"><a href="#动态分派调用（单、多分派）" class="headerlink" title="动态分派调用（单、多分派）"></a>动态分派调用（单、多分派）</h4><p>动态分派调用针对方法的重写：</p>
<ul>
<li>找到操作数栈顶的第一个元素所指向的对象的<strong>实际类型</strong></li>
<li>如果在实际类型中找到与常量池中的描述符和简单名称都相符的方法，则进行访问权限校验，如果通过则直接返回这个方法的直接引用，查找过程结束，如果不通过，抛出异常</li>
<li>按照继承关系从下往上依次对实际类型的各父类（父类编译期就可知道）进行搜索与验证</li>
<li>如果始终没有找到，则抛出 AbstractMethodError</li>
</ul>
<h3 id="动态类型语言支持"><a href="#动态类型语言支持" class="headerlink" title="动态类型语言支持"></a>动态类型语言支持</h3><ul>
<li>静态类型的语言在非运行阶段，变量的类型是可以确定的，也就是说变量是有类型的</li>
<li>动态类型语言在非运行阶段，变量的类型是无法确定的，也就是变量是没有类型的，但是值是有类型的，也就是运行期间可以确定变量的值的类型</li>
</ul>
<h3 id="字节码执行引擎小结"><a href="#字节码执行引擎小结" class="headerlink" title="字节码执行引擎小结"></a>字节码执行引擎小结</h3><ul>
<li>代码执行时涉及的内存结构</li>
<li>如何找到正确的执行方法</li>
<li>如何执行方法的字节码</li>
</ul>
<h2 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h2><ul>
<li>Java 技术体系<ul>
<li>Java 程序设计语言</li>
<li><strong>Java 虚拟机</strong></li>
<li><strong>class 文件格式</strong></li>
<li>Java API</li>
<li>第三方类库</li>
</ul>
</li>
</ul>
<hr>
<ul>
<li>Java 技术体系，认识 Java 虚拟机</li>
<li>内存管理<ul>
<li>运行时内存区域</li>
<li>对象的创建，内存布局以及访问定位</li>
<li>垃圾回收<ul>
<li>判断对象是否存活算法</li>
<li>垃圾收集算法</li>
<li>垃圾收集器</li>
</ul>
</li>
<li>内存的分配</li>
<li>Java 的监控工具</li>
</ul>
</li>
<li>Java 虚拟机的运行<ul>
<li>class 文件格式</li>
<li>class 字节码指令</li>
<li>类加载</li>
<li>字节码执行引擎</li>
</ul>
</li>
</ul>

      
    </div>
    
    
    

    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>请我喝杯咖啡吧☕~</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/images/wechatpay.jpg" alt="Fighter. 微信支付"/>
        <p>微信支付</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/images/alipay.jpg" alt="Fighter. 支付宝"/>
        <p>支付宝</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    
      <div>
        <ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者：</strong>
    Fighter.
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="http://fighterhit.github.io/2018/02/24/Java_Notes/Jvm/类加载/" title="类加载">http://fighterhit.github.io/2018/02/24/Java_Notes/Jvm/类加载/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>
    本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/3.0/" rel="external nofollow" target="_blank">CC BY-NC-SA 3.0</a> 许可协议。转载请注明出处！
  </li>
</ul>

      </div>
    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Java/" rel="tag"># Java</a>
          
            <a href="/tags/Jvm/" rel="tag"># Jvm</a>
          
            <a href="/tags/类加载/" rel="tag"># 类加载</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2018/02/17/Java_Notes/Jvm/类文件/" rel="next" title="类文件">
                <i class="fa fa-chevron-left"></i> 类文件
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2018/03/02/Java_Notes/JavaConcurrence/TheArtOfJavaConcurrency/Ch1-并发编程的挑战/" rel="prev" title="（一）并发编程的挑战">
                （一）并发编程的挑战 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
        <!-- JiaThis Button BEGIN -->
<div class="jiathis_style">
<span class="jiathis_txt">分享到：</span>
<a class="jiathis_button_fav">收藏夹</a>
<a class="jiathis_button_tsina">新浪微博</a>
<a class="jiathis_button_qzone">QQ空间</a>
<a class="jiathis_button_weixin">微信</a>
<a class="jiathis_button_cqq">腾讯QQ</a>
<a class="jiathis_button_copy">复制网址</a>
<a class="jiathis_button_share">一键分享</a>

<a href="http://www.jiathis.com/share?uid=2140465" class="jiathis jiathis_txt jiathis_separator jtico jtico_jiathis" target="_blank">更多</a>
<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" >
var jiathis_config={
  data_track_clickback:true,
  summary:"",
  shortUrl:false,
  hideMore:false
}
</script>
<script type="text/javascript" src="http://v3.jiathis.com/code/jia.js?uid=" charset="utf-8"></script>
<!-- JiaThis Button END -->
      
    </div>
  </div>


          </div>
          


          
  
    <div class="comments" id="comments">
      <div id="lv-container" data-id="city" data-uid="MTAyMC8zMjY0Ni85MjA3"></div>
    </div>
  


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/images/avatar.jpg"
                alt="Fighter." />
            
              <p class="site-author-name" itemprop="name">Fighter.</p>
              <p class="site-description motion-element" itemprop="description">学习 | 分享 | 交流 | 进步</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">26</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">6</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">28</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          <div class="links-of-author motion-element">
            
              
                <span class="links-of-author-item">
                  <a href="https://github.com/fighterhit" target="_blank" title="GitHub">
                    
                      <i class="fa fa-fw fa-github"></i>GitHub</a>
                </span>
              
                <span class="links-of-author-item">
                  <a href="https://weibo.com/fighterhit" target="_blank" title="Weibo">
                    
                      <i class="fa fa-fw fa-weibo"></i>Weibo</a>
                </span>
              
            
          </div>

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#类加载机制"><span class="nav-number">1.</span> <span class="nav-text">类加载机制</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#概述"><span class="nav-number">1.1.</span> <span class="nav-text">概述</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#类加载时机"><span class="nav-number">1.2.</span> <span class="nav-text">类加载时机</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#初始化"><span class="nav-number">1.2.1.</span> <span class="nav-text">初始化</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#不被初始化的例子"><span class="nav-number">1.2.2.</span> <span class="nav-text">不被初始化的例子</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#类加载的过程"><span class="nav-number">1.3.</span> <span class="nav-text">类加载的过程</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#加载"><span class="nav-number">1.3.1.</span> <span class="nav-text">加载</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#加载源"><span class="nav-number">1.3.1.1.</span> <span class="nav-text">加载源</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#验证"><span class="nav-number">1.3.2.</span> <span class="nav-text">验证</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#准备"><span class="nav-number">1.3.3.</span> <span class="nav-text">准备</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#解析"><span class="nav-number">1.3.4.</span> <span class="nav-text">解析</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#初始化-1"><span class="nav-number">1.3.5.</span> <span class="nav-text">初始化</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#类加载器"><span class="nav-number">1.4.</span> <span class="nav-text">类加载器</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#类加载器分类"><span class="nav-number">1.4.1.</span> <span class="nav-text">类加载器分类</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#自定义类加载器的优势"><span class="nav-number">1.4.2.</span> <span class="nav-text">自定义类加载器的优势</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#双亲委派模型"><span class="nav-number">1.4.3.</span> <span class="nav-text">双亲委派模型</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#虚拟机字节码执行引擎"><span class="nav-number">1.5.</span> <span class="nav-text">虚拟机字节码执行引擎</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#运行时栈帧结构"><span class="nav-number">1.5.1.</span> <span class="nav-text">运行时栈帧结构</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#局部变量表"><span class="nav-number">1.5.1.1.</span> <span class="nav-text">局部变量表</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#操作数栈"><span class="nav-number">1.5.1.2.</span> <span class="nav-text">操作数栈</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#动态连接"><span class="nav-number">1.5.1.3.</span> <span class="nav-text">动态连接</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#方法返回地址和附加信息"><span class="nav-number">1.5.1.4.</span> <span class="nav-text">方法返回地址和附加信息</span></a></li></ol></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#方法调用"><span class="nav-number">1.6.</span> <span class="nav-text">方法调用</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#解析调用"><span class="nav-number">1.6.1.</span> <span class="nav-text">解析调用</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#静态分派调用（单、多分派）"><span class="nav-number">1.6.2.</span> <span class="nav-text">静态分派调用（单、多分派）</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#动态分派调用（单、多分派）"><span class="nav-number">1.6.3.</span> <span class="nav-text">动态分派调用（单、多分派）</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#动态类型语言支持"><span class="nav-number">1.7.</span> <span class="nav-text">动态类型语言支持</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#字节码执行引擎小结"><span class="nav-number">1.8.</span> <span class="nav-text">字节码执行引擎小结</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#总结"><span class="nav-number">2.</span> <span class="nav-text">总结</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      
      
    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2016 - <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-home"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Fighter.</span>

  
</div>









        
<div class="busuanzi-count">
  <!--<script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>-->
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv">
      <i class="fa fa-user"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
      
    </span>
  

  
    <span class="site-pv">
      <i class="fa fa-eye"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      
    </span>
  

    <span class="site-pv">&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;
    Hosted by <a target="_blank" href="https://github.com/">GitHub Pages</a>
    </span>

</div>







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.3"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.3"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.3"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.3"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.3"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.3"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.3"></script>



  


  




	





  





  
    <script type="text/javascript">
      (function(d, s) {
        var j, e = d.getElementsByTagName(s)[0];
        if (typeof LivereTower === 'function') { return; }
        j = d.createElement(s);
        j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
        j.async = true;
        e.parentNode.insertBefore(j, e);
      })(document, 'script');
    </script>
  








  





  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script><!-- hexo-inject:begin --><!-- hexo-inject:end -->


  

  
  


  

  

</body>
</html>
